/* Originalmente por Tyranid - 2k5 */
/* Adaptado a PRX. */
#include <pspkernel.h>
#include <pspsdk.h>
#include <stdlib.h>
#include <string.h>


PSP_MODULE_INFO("KDUMPER", PSP_MODULE_KERNEL, 1, 0);
char g_data[0x10000] __attribute__((aligned(64)));

/* Well what would you expect ? :) */
void dump_memregion(const char* file, void *addr, int len) {
	int fd;
	fd = sceIoOpen(file, PSP_O_CREAT | PSP_O_TRUNC | PSP_O_WRONLY, 0777);
	memcpy(g_data, addr, len);
	sceIoWrite(fd, g_data, len);
	sceIoClose(fd);
}

/* Init */
int module_start(SceSize args, void *argp) { 
	dump_memregion("ms0:/kmem.bin", (void*) 0x88000000, 0x10000); /* testear dump      */
	dump_memregion("ms0:/kusb.bin", (void*) 0xBD800000, 0x10000); /* dumpear usb ahora */
	return 0;
}

int module_stop() { 
	return 0;
}


